#!/usr/bin/env python3.8
# -*- encoding: utf-8 -*-
"""
@File    :   models.py
@Time    :   2022/11/15 08:27:15
@Author  :   windstarry 
@Version :   1.0
"""
# here put the import lib
from faker import Faker
from datetime import datetime
import uuid

def get_uid():
    uid = str(uuid.uuid4())
    suid = ''.join(uid.split('-'))
    return suid


class TodoList:
    def __init__(self, task_list):
        self.todo_list = task_list
        self.count = len(task_list)

    @property
    def undone_list(self):
        return list(filter(lambda item: not item["done"], self.todo_list))

    @property
    def done_list(self):
        return list(filter(lambda item: item["done"], self.todo_list))

fake = Faker()
fake = Faker(locale='zh_CN')


def fake_todo_list(count):
    todo_list=[]
    for i in range(count):
        item = {
            "id":get_uid(),
            "title":fake.sentence(),
            'done':fake.boolean(),
            'creat_time':datetime.now().strftime("%Y%m%d")
        }
        todo_list.append(item)
    return todo_list

todo_list = fake_todo_list(6)

todo = TodoList(todo_list)

if __name__ == "__main__":
    print(todo.todo_list)
    print(todo.undone_list)
    print(todo.done_list)